#include <stdio.h>
#include <stdlib.h>

int main (int argc, char const* argv[])
{
    int x, y, n;

    scanf("%d", &n);
    while (n--) {
        scanf("%d %d", &x, &y);
        if (x < y) {
            printf("NO BRAINS\n");
        } else {
            printf("MMM BRAINS\n");
        }
    }

    return 0;
}
